﻿@using System.Text
@using Ganss.XSS
@using WebGrease.Css.Extensions
@{
    ViewBag.Title = "查看文章";
    var article = ViewBag.article as HynuIOTA.Entity.BlogArticle;

    var sanitizer = new HtmlSanitizer();

    string tags = string.Empty;
    if (article.Tags.Any())
    {
        StringBuilder tagslsSbBuilder = new StringBuilder();
        article.Tags.ForEach(a => tagslsSbBuilder.Append($"{a.TagName},"));
        tags = tagslsSbBuilder.ToString().Substring(0, tagslsSbBuilder.Length - 1);
    }
}
@section headSection
{
    <link href="~/Content/style.css" rel="stylesheet"/>
    <style>
        body {
            margin: 20px;
        }
    </style>
}
<header class="article-header">
    <h1 class="article-title"><a href="@Url.RouteUrl("ShowArticle",new{Id = article.Id})" title="@article.Title">@article.Title</a></h1>
    <div class="article-meta">
        <span class="item article-meta-time"><time class="time" data-toggle="tooltip" data-placement="bottom" title="" data-original-title="发表时间：@article.WriteTime"><i class="glyphicon glyphicon-time"></i> @article.WriteTime</time></span>
        <span class="item article-meta-source" data-toggle="tooltip" data-placement="bottom" title="" data-original-title="来源：@article.User.UserName"><i class="glyphicon glyphicon-globe"></i><a href="@Url.Content("~/Blogs/Blog/UBlogList?id=")@article.UserId"> @article.User.UserName</a></span><span class="item article-meta-views" data-toggle="tooltip" data-placement="bottom" title="" data-original-title="浏览量：@article.VisitCount"><i class="glyphicon glyphicon-eye-open"></i> @article.VisitCount</span><span class="item article-meta-comment" data-toggle="tooltip" data-placement="bottom" title="" data-original-title="评论量"><i class="glyphicon glyphicon-comment"></i> @article.CommentCount</span>
    </div>
</header>
<article style="color: #999;">
    <b>摘要：</b>@article.Summary
</article>
<hr />
<article class="article-content">
    @Html.Raw(sanitizer.Sanitize(article.Content))
</article>
<div class="article-tags">
    标签：@tags
</div>